#include "stdafx.h"
#include "Fakes/FakeD3D11Device.h"
#include "Fakes/FakeD3D11Resource.h"
#include "Fakes/FakeD3D11Texture1D.h"
#include "Fakes/FakeD3D11Texture2D.h"
#include "Fakes/FakeD3D11Texture3D.h"
#include "Fakes/FakeD3D11UnorderedAccessView.h"

DESCRIPTION_11_TEST_SUITE_CTOR(UnorderedAccessViewDescription, (D3D11_UAV_DIMENSION_TEXTURE1D))

BOOST_FIXTURE_TEST_CASE(DefaultTexture1D, TestUnorderedAccessViewDescription)
{
	BOOST_REQUIRE_EQUAL(D3D11_UAV_DIMENSION_TEXTURE1D, m_desc.ViewDimension);
	BOOST_REQUIRE_EQUAL(DXGI_FORMAT_UNKNOWN, m_desc.Format);
	BOOST_REQUIRE_EQUAL(0, m_desc.Texture1D.MipSlice);
}

DESCRIPTION_11_SETTER_TEST_CASE(DXGI_FORMAT, Format, DXGI_FORMAT_R8G8B8A8_UINT, UnorderedAccessViewDescription)

BOOST_FIXTURE_TEST_CASE(CreateNoData, TestUnorderedAccessViewDescription)
{
	FakeD3D11Device device;
	FakeD3D11UnorderedAccessView view;
	device.CreateUnorderedAccessViewFakeResult = &view;
	device.CreateUnorderedAccessViewFakeHResult = S_OK;
	FakeD3D11Resource resource;
	ID3D11UnorderedAccessView *result = m_desc.Create(&device, &resource);
	BOOST_REQUIRE(device.CreateUnorderedAccessViewCalled);
	BOOST_REQUIRE_EQUAL(&m_desc, device.CreateUnorderedAccessViewLastDesc);
	BOOST_REQUIRE_EQUAL(&resource, device.CreateUnorderedAccessViewLastResource);
	BOOST_REQUIRE_EQUAL(&view, result);
}

TEXTURE_SETTER_TEST_CASE_DEFAULT(FormatFromTexture1D, TestUnorderedAccessViewDescription, Format, \
								 FakeD3D11Texture1D, Texture1DDescription(DXGI_FORMAT_R8G8B8A8_UINT, 256), \
								 Format, DXGI_FORMAT, DXGI_FORMAT_R8G8B8A8_UINT)

TEXTURE_SETTER_TEST_CASE_DEFAULT(FormatFromTexture2D, TestUnorderedAccessViewDescription, Format, \
								 FakeD3D11Texture2D, Texture2DDescription(DXGI_FORMAT_R8G8B8A8_UINT, 256, 256), \
								 Format, DXGI_FORMAT, DXGI_FORMAT_R8G8B8A8_UINT)

TEXTURE_SETTER_TEST_CASE_DEFAULT(FormatFromTexture3D, TestUnorderedAccessViewDescription, Format, \
								 FakeD3D11Texture3D, Texture3DDescription(DXGI_FORMAT_R8G8B8A8_UINT, 256, 256, 256), \
								 Format, DXGI_FORMAT, DXGI_FORMAT_R8G8B8A8_UINT)

BOOST_AUTO_TEST_SUITE_END()
